<script setup>
import { ref, computed } from 'vue'
import TeamMemberCard from '../components/TeamMemberCard.vue'
import { injectLanguage } from '../utils/language-store.js'

// 使用语言服务
const { currentLang, t } = injectLanguage()

// 计算属性，确保语言切换时团队成员数据会更新
const teamMembers = computed(() => [
  {
    id: 1,
    name: t('about.team.member1.name'),
    position: t('about.team.member1.position'),
    bio: t('about.team.member1.bio'),
    avatar: 'https://picsum.photos/200/200?random=1',
    socialLinks: {
      twitter: '#',
      linkedin: '#',
      github: '#'
    }
  },
  {
    id: 2,
    name: t('about.team.member2.name'),
    position: t('about.team.member2.position'),
    bio: t('about.team.member2.bio'),
    avatar: 'https://picsum.photos/200/200?random=2',
    socialLinks: {
      twitter: '#',
      linkedin: '#',
      github: '#'
    }
  },
  {
    id: 3,
    name: t('about.team.member3.name'),
    position: t('about.team.member3.position'),
    bio: t('about.team.member3.bio'),
    avatar: 'https://picsum.photos/200/200?random=3',
    socialLinks: {
      twitter: '#',
      linkedin: '#',
      github: '#'
    }
  },
  {
    id: 4,
    name: t('about.team.member4.name'),
    position: t('about.team.member4.position'),
    bio: t('about.team.member4.bio'),
    avatar: 'https://picsum.photos/200/200?random=4',
    socialLinks: {
      twitter: '#',
      linkedin: '#',
      github: '#'
    }
  }
])

// 企业文化数据键名
const valueKeys = [
  'innovation',
  'integrity',
  'excellence',
  'collaboration'
]
</script>

<template>
  <div class="about">
    <!-- 公司介绍 -->
    <section class="company-intro">
      <div class="container">
        <h2 v-text="t('about.title')"></h2>
        <p v-text="t('about.intro.paragraph1')"></p>
        <p v-text="t('about.intro.paragraph2')"></p>
      </div>
    </section>

    <!-- 团队介绍 -->
    <section class="team">
      <div class="container">
        <h2 v-text="t('about.team.title')"></h2>
        <div class="team-members">
          <TeamMemberCard 
            v-for="member in teamMembers" 
            :key="member.id"
            :member="member"
          />
        </div>
      </div>
    </section>

    <!-- 企业文化 -->
    <section class="culture">
      <div class="container">
        <h2 v-text="t('about.culture.title')"></h2>
        <div class="values">
          <div class="value-card" v-for="(key, index) in valueKeys" :key="index">
            <h3 v-text="t(`about.culture.values.${key}.title`)" ></h3>
            <p v-text="t(`about.culture.values.${key}.description`)" ></p>
          </div>
        </div>
      </div>
    </section>
  </div>
</template>

<style scoped>
.about {
  font-family: 'Arial', sans-serif;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 50px 20px;
}

.company-intro h2, .team h2, .culture h2 {
  text-align: center;
  font-size: 2.8rem;
  margin-bottom: 3.5rem;
  color: #333;
  position: relative;
}

.company-intro h2::after, .team h2::after, .culture h2::after {
  content: '';
  display: block;
  width: 80px;
  height: 4px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  margin: 1rem auto;
  border-radius: 2px;
}

.company-intro p {
  font-size: 1.2rem;
  line-height: 1.8;
  color: #555;
  margin-bottom: 2rem;
  text-align: center;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.team-members {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2.5rem;
  margin-bottom: 5rem;
}

.values {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2.5rem;
}

.value-card {
  background: white;
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.value-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.12);
  border-color: rgba(102, 126, 234, 0.2);
}

.value-card h3 {
  font-size: 1.7rem;
  margin-bottom: 1.2rem;
  color: #333;
  font-weight: 700;
}

.value-card p {
  color: #666;
  line-height: 1.7;
  font-size: 1.1rem;
}

@media (max-width: 768px) {
  .container {
    padding: 3rem 1.5rem;
  }
  
  .company-intro h2, .team h2, .culture h2 {
    font-size: 2.2rem;
  }
  
  .team-members, .values {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}
</style>